<html>
<head>
    <link rel="stylesheet" href="__STATIC__assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="__STATIC__assets/module/admin.css"/>
</head>
<body>
<div style="padding: 5px 5px 15px 24px;" id="demoUrlDialog">
<style>
.pi-label{
	margin-left: 10px;
	margin-bottom:5px;
}
.pi-input-block {
	position: relative;
    margin-left: 10px;
    min-height: 36px;
}
.pi-label small{
	color: brown;margin-left:5px;
}
</style>    
<form id="modelUserForm" lay-filter="modelUserForm" class="layui-form model-form">
    <input name="game_id" type="hidden" value="{$data.id}"/>
    <div class="layui-form-item">
		<div class="pi-label">备注<small>账户备注,便于商户自行区分账户</small></div>
		<div class="pi-input-block">
			<input name="username" value="" lay-verify="required" placeholder="请输入备注信息方便查询" class="layui-input" lay-verType="tips" required/>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="pi-label">日限额 <small>为0则不限制</small></div>
		<div class="pi-input-block">
			<input name="r_money" lay-verify="required" value="0" placeholder="请输入日限额" class="layui-input" lay-verType="tips" required/>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="pi-label">总限额 <small>为0则不限制</small></div>
		<div class="pi-input-block">
			<input name="z_money" lay-verify="required" value="0" placeholder="请输入总限额" class="layui-input" lay-verType="tips" required/>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="pi-label">支付宝CK参数<small><button type="button" class="layui-btn layui-bg-red layui-btn-xs" onclick="getqrcode();" id="dadsa">点击扫码登录</button></small></div>
		<div class="pi-input-block">
		     <img  style="display: block;" id='src' width="150" height="150" alt="请重新获取"/><div id="wenben"></div>
		     <textarea name="ck" id="cookie" placeholder="请点击上面扫码登录，扫描二维码后获取到的CK会显示到这里" class="layui-textarea" lay-vertype="tips" ></textarea>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="pi-label">支付宝UID <small>扫描二维码后获取到UID</small></div>
		<div class="pi-input-block">
			<input name="zhanghao" id="zhanghao" lay-verify="required" value="" placeholder="请点击上面扫码登录，扫描二维码后获取到的UID会显示到这里" class="layui-input" lay-verType="tips" required/>
		</div>
	</div>
		<div class="layui-form-item">
		<div class="pi-label">支付方式 <small>选择{$data.game_name}的支付方式（支付宝或微信或Q Q）</small></div>
		<div class="pi-input-block">
		     <select name="type" lay-verType="tips" lay-verify="required" required>
                 <option value="1" >支付宝</option>
             </select>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="pi-label">支付模式 <small>选择{$data.game_name}的支付模式（H5或扫码）</small></div>
		<div class="pi-input-block">
		     <select name="ms" lay-verType="tips" lay-verify="required" required>
                 <option value="1" >扫码</option>
                 <option value="0" >H5</option>
            </select>
		</div>
	</div>
	<div class="layui-form-item">
		<div class="pi-label">回调方式 <small>异步通知的回调方式</small></div>
		<div class="pi-input-block">
		     <select name="method" lay-verType="tips" lay-verify="required" required>
		         <option value="get"  >GET</option>
		         <option value="post" >POST</option>
             </select>
		</div>
	</div>
	
    <div class="layui-form-item text-right">
        <button class="layui-btn layui-btn-primary" type="button" ew-event="closeDialog">取消</button>
        <button class="layui-btn" lay-filter="modelSubmitUser" lay-submit>保存</button>
    </div>
	<div class="layui-form-item">
		<div class="pi-input-block">
           <div class="layui-col-sm6">
             <div class="layui-card">
                <div class="layui-card-header">{$data.game_name} 操作教程</div>
                <div class="layui-card-body" style="padding: 5px;min-height: 154px;box-sizing: border-box;">
                   <div id="otherVideo2"></div>
                </div>
             </div>
           </div>
		</div>
	</div>
    
</form>
</div>
<!-- js部分 -->
<script src="https://cdn.jsdelivr.net/npm/jquery@1.11.3"></script>
<script type="text/javascript" src="__STATIC__assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="__STATIC__assets/js/common.js"></script>
<script>
    layui.use(['layer', 'form', 'admin', 'upload', 'formX', 'Player'], function () {
        var $ = layui.jquery, layer = layui.layer, form = layui.form, admin = layui.admin, formX = layui.formX, upload = layui.upload, Player = layui.Player;
        $("#src").hide();
        //getqrcode();
        admin.iframeAuto();
        var mUser = admin.getLayerData().data;  // 获取列表页面传递的数据
        // 回显数据，这里一定要用formX.val，form.val不能回显跨iframe的数据
        formX.val('modelUserForm', mUser);
        // 表单提交事件
        form.on('submit(modelSubmitUser)', function (data) {
            layer.load(2);
            var url = admin.getLayerData().url;
            $.post(url, data.field, function (res) {
                layer.closeAll('loading');
                if (res.code == 1) {
                    layer.msg(res.msg, {icon: 1});
                    admin.putLayerData('formOk', true);  // 设置操作成功的标识
                    admin.closeThisDialog();  // 关闭当前iframe弹窗
                } else {
                    layer.msg(res.msg, {icon: 2});
                }
            }, 'json');
            return false;
        });
        // 开启弹幕
        var dmStyle = {
            color: '#FF5722', fontSize: true
        };
        new Player({
            id: 'otherVideo2',
            url: 'https://ksv-video-publish.cdn.bcebos.com/2e7506a6297297dbe7cdca1561abec9f462814a4.mp4?auth_key=1677247775-0-0-b1cd507b203295633bb9cc086ff0f530',// 视频地址
            poster: 'https://ksv-video-picture.cdn.bcebos.com/81d22a618af981260789203019f4570b5fd13a4e.jpg',  // 封面
            autoplay: false,
            fluid: true,  // 宽度100%
            pip: true,
            lang: 'zh-cn',
            danmu: {
                comments: [
                    {id: '1', start: 0, txt: '请认真观看', color: true, style: dmStyle, duration: 15000},
                    {id: '2', start: 6500, txt: '不懂联系客服', color: true, style: dmStyle, duration: 15000},
                    {id: '3', start: 12000, txt: '请认真观看', color: true, style: dmStyle, duration: 15000},
                    {id: '4', start: 19000, txt: '不懂联系客服', color: true, style: dmStyle, duration: 15000},
                    {id: '5', start: 26000, txt: '本站由未央-请保留版权提供技术服务支持', color: true, style: dmStyle, duration: 15000}
                ]
            }
        });
    });
    function getqrcode(){    
        $.post('api',{
             game_dm:"zfb_gck",
             type:"exec",
        }, function(res){
                if (res.code === 1) {
                    var qrid = res.data.loginid;
                    var url = "../pay/enQrcode?url=" + res.data.qrcodeurl;
                    $("#src").attr("src",url);
                    $("#src").show();
                    $("#wenben").show();
                    $("#dadsa").html('重新获取二维码');
                    $("#cookie").val('请使用手机对着手机扫或电脑配合手机扫码，不可使用截图扫码');
                    order(qrid);
                    layer.msg(res.msg, {icon: 1, anim: 6});
               } else {
                    layer.msg(res.msg, {icon: 2, anim: 6});
               }
        }, 'json');
    }
    function order(id){
        $.post('api',{
          game_dm:"zfb_gck",
          type:"cehsald",
          post: {loginid: id},
        }, function(res){
            if(res.code == '1'){
                $("#src").hide();
                $("#wenben").hide();
                layer.msg(res.msg, {icon: 1, anim: 6});
                $("#cookie").val(res.data.cookie);
                $.post('api',{
                  game_dm:"zfb_gck",
                  type:"queryuser",
                  post: {ck: res.data.cookie},
                }, function(res){
                    $("#zhanghao").val(res.data.data.userId);
                }, 'json');    
            }else{
                $("#wenben").html(res.msg);
                setTimeout(function (){order(id);}, 3000);
            }
        }, 'json');
    }
</script>
</body>
</html>